package com.example.lasttrain.common;

import java.lang.*;
import java.util.ArrayList;

/** 終電情報格納クラス */
public class TrainEntry {

	//test data
	private static TrainEntry newEntryBuffer = null;
	
	public static void setNewEntry(TrainEntry newEntry){
		newEntryBuffer = newEntry;
	}
	public static void clearNewEntry(){
		newEntryBuffer = null;
	}
	public static TrainEntry getNewEntry(){
		return newEntryBuffer;
	}

	
	/** メンバ変数 */
	// パターン名
	private String name;
	// ID(新規登録の場合は-1)
	private int dbId;
	// 終電時刻
	private TimeData trainTime;
	// 出発駅名
	private String startStation;
	// 到着駅名
	private String endStation;
	// アラーム設定時刻(-1で設定なし)
	private int alarmtime;
	// アラームフラグ（0：OFF、1:ON）
	private int alarmFlg;
	

	/***
	 * コンストラクタの設定
	 * 各値を初期化
	 */
	public TrainEntry(){
		this.name = "";
		this.dbId = -1;
		this.trainTime = null;
		this.startStation = "";
		this.endStation = "";
		this.alarmtime = -1;
		this.alarmFlg = 0;
	}
	
	public TrainEntry(String name, TimeData trainTime){
		this.name = name;
		this.dbId = -1;
		this.trainTime = trainTime;
		this.startStation = "";
		this.endStation = "";
		this.alarmtime = -1;
		this.alarmFlg = 0;
	}
	
	public TrainEntry(String name, int dbId, TimeData trainTime){
		this.name = name;
		this.dbId = dbId;
		this.trainTime = trainTime;
		this.startStation = "";
		this.endStation = "";
		this.alarmtime = -1;
		this.alarmFlg = 0;
	}
	
	public TrainEntry(String name, int dbId, TimeData trainTime, String startStation, String endStation){
		this.name = name;
		this.dbId = dbId;
		this.trainTime = trainTime;
		this.startStation = startStation;
		this.endStation = endStation;
		this.alarmtime = -1;
		this.alarmFlg = 0;
	}	

	public TrainEntry(String name, int dbId, TimeData trainTime, String startStation, String endStation, int alarmtime){
		this.name = name;
		this.dbId = dbId;
		this.trainTime = trainTime;
		this.startStation = startStation;
		this.endStation = endStation;
		this.alarmtime = alarmtime;
		this.alarmFlg = 0;
	}
	
	public TrainEntry(String name, int dbId, TimeData trainTime, String startStation, String endStation, int alarmtime, int alarmFlg){
		this.name = name;
		this.dbId = dbId;
		this.trainTime = trainTime;
		this.startStation = startStation;
		this.endStation = endStation;
		this.alarmtime = alarmtime;
		this.alarmFlg = alarmFlg;
	}
	
	/** 各値のsetter、getter */
	public void setName(String name){
		this.name = name;
	}
	
	public String getName(){
		return name;
	}
	
	public int getDbId() {
		return dbId;
	}

	public void setDbId(int dbId) {
		this.dbId = dbId;
	}
	
	public void setStartStation(String startStation){
		this.startStation = startStation;
	}
	
	public String getStartStation(){
		return startStation;
	}
	
	public void setEndStation(String endStation){
		this.endStation = endStation;
	}
	
	public String getEndStation(){
		return endStation;
	}
	
	public TimeData getTrainTime() {
		return trainTime;
	}

	public void setTrainTime(TimeData trainTime) {
		this.trainTime = trainTime;
	}

	public int getAlarmtime() {
		return alarmtime;
	}

	public void setAlarmtime(int alarmtime) {
		this.alarmtime = alarmtime;
	}

	public int getAlarmFlg() {
		return alarmFlg;
	}
	
	public void setAlarmFlg(int alarmFlg) {
		this.alarmFlg = alarmFlg;
	}
	
}

